package com.example.volunteer.mapper;


import com.example.volunteer.model.Apply;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;


import java.util.Date;
import java.util.List;


@Mapper
public interface ApplyMapper {
    void insert(Apply apply);
    Apply findByActivityAndVolunteer(Integer activityId, String volunteerId);
    void update(Apply apply);
    void delete(@Param("activityId") Integer activityId, @Param("volunteerId") String volunteerId);

    int countVolundeerIdActivities(String volunteerId);

    List<Apply> findAppliesWithPage(@Param("offset") int offset, @Param("pageSize") int pageSize);
    int countApplies();

    List<Apply> findByVolunteerIdWithPage(@Param("volunteerId") String volunteerId, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByVolunteerId(@Param("volunteerId") String volunteerId);

    List<Apply> findByActivityIdWithPage(@Param("activityId") Integer activityId, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByActivityId(@Param("activityId") Integer activityId);

    List<Apply> findByStatusWithPage(@Param("status") String status, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByStatus(@Param("status") String status);

    List<Apply> findByTimeWithPage(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("offset") int offset, @Param("pageSize") int pageSize);

    int countByTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
}
